<template>
  <div class="app">
    <el-tree :data="data" :props="defaultProps" @node-click="handleNodeClick"></el-tree>
  </div>
</template>
<script>
import axios from "axios";

export default {
  name: "app",
  data() {
    return {
      data: [],
      defaultProps: {
        children: 'children',
        label: 'name'
      }
    };
  },
  created() {
    this.getELmentTree()
  },
  mounted() {
  },
  methods: {
    handleNodeClick(data) {
      console.log(data);
    },

    getELmentTree() {
      axios
          // 3.1url地址
          .get("http://192.168.56.10/curl/pms-category/elementTree")
          // 3.2成功时回调函数
          .then((data) => {

            console.log(data.data.data);

            this.data = data.data.data

          })
          //3.3失败时回调函数
          .catch((err) => {
            console.log(err);
          });
    }
  }
};
</script>
